package com.example.doubanfilm;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.adapter.RecyclerViewAdapterForSearch;

public class SearchActivity extends AppCompatActivity {
    private ImageView returnIcon;
    private RecyclerView search_recyclerView;


    private View.OnClickListener  listener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // 点击结束当前Activity,自动返回上一页面
            SearchActivity.this.finish();
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search);
        returnIcon = findViewById(R.id.returnIcon);
        search_recyclerView = findViewById(R.id.search_recyclerView);

        search_recyclerView.setLayoutManager(new LinearLayoutManager(this));
        search_recyclerView.setAdapter(new RecyclerViewAdapterForSearch(this));
        search_recyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));

        /*TextView text = findViewById(R.id.text);
        String string = getString(R.string.film_score);
        text.setText(String.format(string, "9.8"));*/
        returnIcon.setOnClickListener(listener);
    }
}